﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.ComponentModel.Composition;

using org.theGecko.Utilities.MefMvc;

using LeMigue.TeamPortal.Base.Mvc;
using LeMigue.TeamPortal.Base.View;
using LeMigue.Scrum.TfsScrumV1.Service;
using LeMigue.Scrum.Iterface.Service;
using LeMigue.TeamPortal.Base.Biz.Interface;
using LeMigue.TeamPortal.Base.Biz.Implement;
using LeMigue.TeamPortal.Base.Biz;

namespace LeMigue.TeamPortal.Membros.Controllers
{
    [ControllerMetaData("Membros")]
    [Export(typeof(IController)), PartCreationPolicy(CreationPolicy.NonShared)]
    [Authorize]
    [CheckTeam]
    public class MembrosController : TeamPortalController
    {
        private IMemberBiz MemberBiz = FactoryBiz.MemberBiz;

        public ActionResult Index()
        {
            return View();
        }

        [ContainerHome("Membros", 3)]
        public PartialViewResult HomeBox()
        {
            return PartialView();
        }

        [ChildActionOnly]
        public PartialViewResult TreeMembers()
        {
            IList<MemberView> membros = MemberBiz.List(Team);
                
            if (membros.Count > 0)
                return PartialView(membros);

            return PartialView("NoMembers");
        }

    }
}
